﻿<html>
<head>
<mrta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</mrta>
<head>
<script>

    function start1(){
         // 实现定时器，setTimeout(code,millisec)

         setTimeout(
             function(){
             alert("3秒时间到");
             },3000
         );
    }
    function start2(){
        var i=5;
        var s=setInterval(
           function(){
               document.write(i +"<br>/");
               i --;
               if(i ==0){
                   clearInterval(s);
               }
           } ,1000
        );
    }
    </script>
    </head>
    <boay>
        <a href="#" onclick="start1()">定时</a>
        <a href="#" onclick="start2()">定时器</a>
    </boay>
    </html>